import request from '@/request/request'

// 分页查询复盘单
export function getInventoryRecheckPage(params) {
  return request({ method: 'get', url: '/check/recheck/page', params })
}

// 获取复盘单详情（含明细）
export function getInventoryRecheckWithDetails(id) {
  return request({ method: 'get', url: `/check/recheck/withDetails/${id}` })
}

// 创建复盘单
export function createInventoryRecheck(data) {
  return request({ method: 'post', url: '/check/recheck', data })
}

// 更新复盘单
export function updateInventoryRecheck(data) {
  return request({ method: 'put', url: '/check/recheck', data })
}

// 删除复盘单
export function deleteInventoryRecheck(id) {
  return request({ method: 'delete', url: `/check/recheck/${id}` })
}

// 审核复盘单
export function auditInventoryRecheck(id) {
  return request({ method: 'put', url: `/check/recheck/audit/${id}` })
}

// 作废复盘单
export function voidInventoryRecheck(id) {
  return request({ method: 'put', url: `/check/recheck/void/${id}` })
}

// 根据盘点单ID获取复盘单列表
export function getRecheckByCheckId(checkId) {
  return request({ method: 'get', url: `/check/recheck/byCheckId/${checkId}` })
}

// 获取商品在指定仓库的系统库存数量
export function getProductStockQuantity(productId, warehouseId) {
  return request({ method: 'get', url: `/check/inventory/stock/${productId}/${warehouseId}` })
}
